Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@stacks/network
Advanced tools
Network and API library for working with Stacks blockchain nodes.
npm install @stacks/network
Creating a Stacks mainnet, testnet or mocknet network
import { StacksMainnet, StacksTestnet, StacksMocknet } from '@stacks/network';
const network = new StacksMainnet();
const testnet = new StacksTestnet();
const mocknet = new StacksMocknet();
Setting a custom node URL
network.coreApiUrl = 'https://www.mystacksnode.com/';
Check if network is mainnet
const isMainnet = network.isMainnet();
Example usage in transaction builder
import { makeSTXTokenTransfer } from '@stacks/transactions';
const txOptions = {
network,
recipient: 'SP2BS6HD7TN34V8Z5BNF8Q2AW3K8K2DPV4264CF26',
amount: new BigNum(12345),
senderKey: 'b244296d5907de9864c0b0d51f98a13c52890be0404e83f273144cd5b9960eed01',
};
const transaction = await makeSTXTokenTransfer(txOptions);
Get various API URLs
const txBroadcastUrl = network.getBroadcastApiUrl();
const feeEstimateUrl = network.getTransferFeeEstimateApiUrl();
const address = 'SP2BS6HD7TN34V8Z5BNF8Q2AW3K8K2DPV4264CF26';
const accountInfoUrl = network.getAccountApiUrl(address);
const contractName = 'hello_world';
const abiUrl = network.getAbiApiUrl(address, contractName);
const functionName = 'hello';
const readOnlyFunctionCallUrl = network.getReadOnlyFunctionCallApiUrl(address, contractName, functionName);
const nodeInfoUrl = network.getInfoUrl();
const blockTimeUrl = network.getBlockTimeInfoUrl();
const poxInfoUrl = network.getPoxInfoUrl();
1.2.2 (2021-02-16)
Note: Version bump only for package stacks.js
FAQs
Library for Stacks network operations
The npm package @stacks/network receives a total of 86,260 weekly downloads. As such, @stacks/network popularity was classified as popular.
We found that @stacks/network demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.